<template>
	<view>
		<div style="display:flex;">


			<!--<div  class="balance_btn">-->
			<button class="button button-fill button-big" @click="jump('/pages/my/my_management_recommend/my_vip')">会员升级</button>
			<!--</div>-->

			<!--<div  class="balance_btn">-->
			<button class="button button-fill button-big"  @click="jump('/pages/my/my_management_recommend/my_upgrade')">申请服务商</button>
			<!--</div>-->

		</div>
		<div v-for="vo,index in grade">
			<div class="vip-user-list" @click="jump('/pages/my/my_management_recommend/my_management_detail',{'grade_id':vo.grade_id,'grade_type':vo.grade_type})">
				<div class="vip-grade">
					<img class="lazy" :src="vo.vip_image">
				</div>
				<div class="vip-total flex flex-box-y">
					<div>{{vo.grade_name}}</div>
					<div class="flex"></div>
					<div>一共{{vo.direct_num}}人</div>
				</div>
				<div class="flex-xy-center" v-if="vo.grade_num>0" style="font-size: 12px;">分享{{vo.grade_num}}人即可免费升级
				</div>
				<span class="vip-right iconfont icon-right"></span>
			</div>
		</div>

		<div v-for="vo,index in mana">
			<div class="vip-user-list"  @click="jump('/pages/my/my_management_recommend/my_management_detail',{'mana_id':mana_id,'grade_type':vo.grade_type})">
				<div class="vip-grade">
					<img :src="vo.vip_image">
				</div>
				<div class="vip-total flex flex-box-y">
					<div>{{vo.grade_name}}</div>
					<div class="flex"></div>
					<div>一共{{vo.direct_num}}人</div>
				</div>
				<span class="vip-right iconfont icon-right"></span>
			</div>
		</div>

		</div>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				users: [{
						img: "https://shop.zdsy.shop/themes/screens/public/assets/images/vip_1.png",
						name: '直推',
						total: 5
					},
					{
						img: "https://shop.zdsy.shop/themes/screens/public/assets/images/vip_1.png",
						name: '间推',
						total: 5
					}
				],
				grade: [],
				mana: []
			}
		},
		onLoad() {
			this.get_data()
		},
		methods: {
			jump(url,data) {
				// this.$isLogin 判断是否登录，true:弹窗提醒
				if (this.$isLogin(true)) {
					this.$u.route(url,data);
				}
			},
			get_data() {
				this.$api.get({
					url: 'portal/my/my_management_recommend',
					success: res => {
						console.log(res)
						if (res.code == 1) {
							this.grade = res.data.grade;
							this.mana = res.data.mana
						} else {
							this.$toast('数据获取失败');
						}
					}
				});
			}
		}
	}
</script>

<style>
	body {
		margin: 0;
		padding: 0;
	}

	#app {
		margin: 10px;
	}

	.vip-user-list {
		margin-bottom: 10px;
		background: #fff;
		box-shadow: 0 0 2px 2px #f1f1f1;
		padding: 10px;
		display: flex;
	}

	.vip-grade {
		width: 64px;
		height: 64px;
	}

	.vip-grade img {
		border-radius: 50%;
	}

	img {
		width: 100%;
		height: 100%;
	}

	.vip-total {
		margin-left: 10px;
		color: #333;
	}

	.flex-box-y {
		-webkit-box-orient: vertical;
		-webkit-box-direction: normal;
		-ms-flex-direction: column;
		flex-direction: column;
		display: -webkit-flex
	}

	.flex {
		flex: 1;
	}

	.vip-right {
		display: flex;
		align-items: center;
	}

	a:link {
		text-decoration: none;
	}

	a:visited {
		text-decoration: none;
	}

	a:hover {
		text-decoration: none;
	}

	a:active {
		text-decoration: none;
	}

	a {
		color: #666;
	}

	.flex-xy-center {
		-webkit-box-pack: center;
		-ms-flex-pack: center;
		justify-content: center;
		-webkit-box-align: center;
		-ms-flex-align: center;
		align-items: center;
		display: -webkit-flex;
	}

	.balance_btn button {
		height: 40px;
		line-height: 40px;
		margin: 10px;
		width: 50%;
	}

	.balance_btn {
		width: calc(100% - 20px);
	}

	.button.button-fill {
		color: #fff;
		background: #0894ec;
		border: none;
		line-height: 2.35rem;
		width: 120px;
		margin: 15px;
	}
</style>
